package BinaryTree;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 周斌
 * Date: 2024-03-17
 * Time: 16:33
 */
public class BinaryTreeTest {
    public static void main(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        //枚举法创建二叉树
        BinaryTree.TreeNode root = binaryTree.careTree1();

        //给定一个字符串str
//        String str1 = new String("ABD###CE##F##");
//        String str2 = new String("ABD##E##C##");
//        //给定先序遍历的字符串，然后用先序遍历去创建二叉树
//        BinaryTree.TreeNode root = binaryTree.careTree2(str1);
        //前序遍历/**/
//        binaryTree.preOrder(root);
//        System.out.println();
//        //中序遍历
//        binaryTree.inOrder(root);
//        System.out.println();
//        //后序遍历
//        binaryTree.postOrder(root);
//        System.out.println();
//        //层序遍历
//        binaryTree.levelOrder(root);
//
//
//        System.out.println();
//        System.out.println("结点的个数：");
//        System.out.println(binaryTree.size(root));
//
//        System.out.println("叶子节点的个数：");
//        System.out.println(binaryTree.getLeafNodeCount(root));
//
//        System.out.println("获取第k层的结点个数");
//        System.out.println(binaryTree.getKLevelNodeCount(root, 3));
//
        System.out.println("树的高度为：");
        System.out.println(binaryTree.getHeight(root));
        System.out.println(binaryTree.getHeight1(root));
//
//        System.out.println("检测val值为：");
//        BinaryTree.TreeNode node = binaryTree.find(root, 'A');
//        System.out.println(node.val);
//
//        System.out.println(binaryTree.isCompleteTree(root));

//        binaryTree.Convert(root);

        binaryTree.rightSideView(root);
        binaryTree.leftSideView(root);
    }
}
